package org.example.demo_interface;

// 主程序：你来点餐
public class RestaurantOrder {
    public static void main(String[] args) {
        System.out.println("🍽️ 欢迎来到美食点餐系统！");
        System.out.println("==========================");

        // 场景1：今天想吃中餐
        System.out.println("\n🇨🇳 今天吃中餐：");
        FoodMenu chineseRestaurant = new ChineseRestaurant();  // 选择中餐厅
        orderFood(chineseRestaurant, "张三");                   // 点餐

        // 场景2：明天换美式
        System.out.println("\n🇺🇸 明天换美式：");
        FoodMenu americanRestaurant = new AmericanRestaurant(); // 选择美式餐厅
        orderFood(americanRestaurant, "李四");                   // 点餐

        // 场景3：随机选择餐厅
        System.out.println("\n🎲 随机选择餐厅：");
        FoodMenu thaiRestaurant = new ThaiRestaurant();   // 选择泰式餐厅
        orderFood(thaiRestaurant, "赵六");                      // 点餐

        // 场景3：随机选择餐厅
        System.out.println("\n🎲 随机选择餐厅：");
        FoodMenu randomRestaurant = getRandomRestaurant();
        orderFood(randomRestaurant, "王五");                    // 点餐
    }

    // 点餐方法：同一个方法可以处理所有类型的餐厅
    public static void orderFood(FoodMenu restaurant, String customerName) {
        System.out.println("👨‍🍳 " + customerName + " 点餐中...");

        String kungPao = restaurant.getKungPaoChicken();
        String mapoTofu = restaurant.getMapoTofu();

        System.out.println("🍗 宫保鸡丁: " + kungPao);
        System.out.println("🌶️ 麻婆豆腐: " + mapoTofu);
        System.out.println("✅ 点餐完成！");
    }

    // 随机选择餐厅
    public static FoodMenu getRandomRestaurant() {
        if (Math.random() > 0.5) {
            System.out.println("随机选择了: 中餐厅");
            return new ChineseRestaurant();
        } else {
            System.out.println("随机选择了: 美式餐厅");
            return new AmericanRestaurant();
        }
    }
}